import {request} from "./request";
import axios from 'axios';
import instance from "./dlrequest";
import qs from "qs"

// 目录的各类型接口
export function categoryData(category, page) {
    return request({
        method: "post",
        url: "/api/mogujie/more_page",
        data: {
            page: page,
            index: category,
        }
    })
}

// 轮播图
export const lunbt = () => axios.get('/list.json')
// 首页图片
export const tupian = () => axios.get('/list1.json')
// 购物车
export const shopping = () => axios.get('/shopping.json')
// 收藏
export const collect = () => axios.get('/collect.json')
// 商品详情
export function networkDetailInfo(categoryIndex, id) {
    return request({
        method: "post",
        url: "/api/mogujie/detail",
        data: JSON.stringify({
                index: categoryIndex,
                id: id,
            }
        )
    })
}

// 搜索列表
export function SearchFiledContent(searchFiled, page) {
    return request({
        method: "post",
        url: "/api/mogujie/search",
        data: {
            searchFiled: searchFiled,
            page: page,
        }
    })
}

// qs.stringify()将对象序列化成url形式  ，qs.parse（）将url解析为对象的形式
// 发送短信验证码请求
export const SendYZMAPI = (params) => instance.post("/sendSMS", qs.stringify(params))


//手机号验证码登录(含注册)
export const PhoneLoginAPI = (params) => instance.post("/phoneRegin", qs.stringify(params))


// 微信扫码登录请求  
export const WeixinLoginAPI = (params) => instance.post("/wechatUsers/PCLogin", qs.stringify(params))


// 手机号绑定微信的登录
export const BindPhoneAPI = (params) => instance.post("/wechatUsers/binding", qs.stringify(params))


// 获取登录用户信息
export const UserProfilesAPI = () => instance.get("/shop/userProfiles")


